<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <include file="./Public/Admin/header.html" />
    <style>
        .input-medium{width:300px;}
        input{margin-left: 5px;}
        .img_box{display: none;}
        .btn_add_img{padding-bottom: 0px;padding-top: 10px;display: none;margin-bottom: 20px;margin-left: -20px;}
        .chk{overflow: hidden;}
        .chk input{margin-right: 5px;float: left;}
        .chk label{float: left;margin-right: 5px;}
    </style>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap-datetimepicker.min.css" media="all" />
    <script src="__PUBLIC__/js/bootstrap-datetimepicker.js"></script>
</head>
<body>
<div id="main">
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="box">
                    <div class="box-title">
                        <div class="span10">
                            <h3><i class="icon-edit"></i>添加开房记录</h3>
                        </div>
                        <div class="span2"><a class="btn" href="javascript:window.history.go(-1)">返回</a></div>
                    </div>
                    <div class="box-content">
                        <form action="{:U('Admin/User/addRoom')}" method="post" class="form-horizontal form-validate">
                        <input type="hidden" name="user_id" value="{$userInfo['id']}">
                            <div class="control-group">
                                <label for="user_name" class="control-label">会员姓名：</label>
                                <div class="controls">
                                    <input type="text"  readonly="readonly"  value="{$userInfo['user_name']}" class="input-medium"  data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="phone" class="control-label">会员电话：</label>
                                <div class="controls">
                                    <input type="text" readonly="readonly"  value="{$userInfo['phone']}"  data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="user_card" class="control-label">会员身份证号码：</label>
                                <div class="controls">
                                    <input type="text" readonly="readonly"  value="{$userInfo['user_card']}"   data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="room_name" class="control-label">房间号码：</label>
                                <div class="controls">
                                    <input type="text" name="room_name" id="room_name" class="input-medium"  data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="room_price" class="control-label">消费金额：</label>
                                <div class="controls">
                                    <input type="number" name="room_price" id="room_price" class="input-medium"  data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="user_point" class="control-label">赠送积分：</label>
                                <div class="controls">
                                    <input type="number" name="user_point" id="user_point" class="input-medium"  data-rule-required="true"/><span class="maroon">*</span>
                                </div>
                            </div>

                            <div class="form-actions">
                                <button type="submit" class="btn btn-primary btn_save">保存</button>
                                <a class="btn" href="javascript:window.history.go(-1)">取消</a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function(){

        //保存
        $('.btn_save').click(function(){
            var card_id=$('#user_card').val();
            var phone=$('#phone').val();

            if(phone){
                var tel = /^(13|14|15|17|18)\d{9}$/;//手机
                if (!tel.test(phone)) {
                    G.ui.tips.err("请填写正确的电话号码");
                    return false;
                }
            }
            if(card_id){
                // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
                var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if(!reg.test(card_id)) {
                    G.ui.tips.err('请填写正确的身份证号码');
                    return false;
                }
            }
           
        })
       
    })
</script>
</body>
</html>